<template>
	<el-drawer title="邮件详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="发件人">
						<div style="width: 100%;">
							<span style="position: absolute;margin-left: 15px">{{form.from}}</span>
							<span style="float: right">
								<div>
									<el-icon style="margin-right: 10px;"><el-icon-clock/></el-icon>{{form.createTime}}
								</div>
							</span>
						</div>
					</el-form-item>
					<el-form-item label="邮件标题">
						<span style="font-weight: 600;font-size: 16px">{{form.subject}}</span>
					</el-form-item>
					<el-form-item label="邮件内容">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="邮件附件">
						<div v-for="(item,index) in form.attachFileName">
							<a style="cursor: pointer;color: #409EFF;margin-right: 10px"  @click="downAttach(item)">{{item}}</a>
						</div>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import sysConfig from "@/config";

export default {
	emits: ['success', 'closed'],
	components: {
	},
	data() {
		return {
			loading: false,
			form: {
				date:'',
				subject:"",
				content:"",
				from:"",
				attachFileName:"",
				createTime:""
			},
			model:"rece",
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model){
			this.model=model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data,date){
			this.form.date=date
			this.form.subject=data.subject
			this.form.content=data.content
			this.form.attachFileName=data.attachFileName
			this.form.from=data.from
			this.form.createTime=data.createTime
		},
		downAttach(item){
			this.$nextTick(() => {
				window.open(sysConfig.API_URL+'/get/email/downWebMailAttach?sendTime=' + this.form.createTime + "&date=" + this.form.date+"&fileName=" + item+"&ddtab=true", "_blank");
			})
		}
	}
}
</script>

<style>
</style>
